/**
 */
package org.xtext.example.mydsl.myDsl.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.xtext.example.mydsl.myDsl.Library;
import org.xtext.example.mydsl.myDsl.MyDslPackage;
import org.xtext.example.mydsl.myDsl.Prototype;
import org.xtext.example.mydsl.myDsl.Texture;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Library</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.LibraryImpl#getTextures <em>Textures</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.LibraryImpl#getPrototypes <em>Prototypes</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class LibraryImpl extends TypeImpl implements Library
{
  /**
   * The cached value of the '{@link #getTextures() <em>Textures</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTextures()
   * @generated
   * @ordered
   */
  protected EList<Texture> textures;

  /**
   * The cached value of the '{@link #getPrototypes() <em>Prototypes</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPrototypes()
   * @generated
   * @ordered
   */
  protected EList<Prototype> prototypes;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected LibraryImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MyDslPackage.Literals.LIBRARY;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Texture> getTextures()
  {
    if (textures == null)
    {
      textures = new EObjectContainmentEList<Texture>(Texture.class, this, MyDslPackage.LIBRARY__TEXTURES);
    }
    return textures;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Prototype> getPrototypes()
  {
    if (prototypes == null)
    {
      prototypes = new EObjectContainmentEList<Prototype>(Prototype.class, this, MyDslPackage.LIBRARY__PROTOTYPES);
    }
    return prototypes;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MyDslPackage.LIBRARY__TEXTURES:
        return ((InternalEList<?>)getTextures()).basicRemove(otherEnd, msgs);
      case MyDslPackage.LIBRARY__PROTOTYPES:
        return ((InternalEList<?>)getPrototypes()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MyDslPackage.LIBRARY__TEXTURES:
        return getTextures();
      case MyDslPackage.LIBRARY__PROTOTYPES:
        return getPrototypes();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MyDslPackage.LIBRARY__TEXTURES:
        getTextures().clear();
        getTextures().addAll((Collection<? extends Texture>)newValue);
        return;
      case MyDslPackage.LIBRARY__PROTOTYPES:
        getPrototypes().clear();
        getPrototypes().addAll((Collection<? extends Prototype>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.LIBRARY__TEXTURES:
        getTextures().clear();
        return;
      case MyDslPackage.LIBRARY__PROTOTYPES:
        getPrototypes().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.LIBRARY__TEXTURES:
        return textures != null && !textures.isEmpty();
      case MyDslPackage.LIBRARY__PROTOTYPES:
        return prototypes != null && !prototypes.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //LibraryImpl
